package acm.蓝桥4;

import java.util.Scanner;

public class 水题 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[][] nums = new long[3][n];
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < n; j++) {
                nums[i][j] = sc.nextInt();
            }
        }
        long res = 0;
        for (int i = 0; i < nums[0].length; i++) {
            for (int j = 0; j < nums[1].length; j++) {
                if (nums[1][j] > nums[0][i]) {
                    for (int k = 0; k < nums[2].length; k++) {
                        if (nums[2][k] > nums[1][j]) {
                            res++;
                        }
                    }
                }
            }
        }
        System.out.println(res);
    }
}
